package Exer03_分支;

import java.util.Scanner;

public class _1_3_6_计算器 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数:");
        double num1 = scanner.nextDouble();
        System.out.println("请输入第二个数:");
        double num2 = scanner.nextDouble();
        System.out.println("请输入符号:");
        String signal = scanner.next();
        switch (signal){

            case "+":
                System.out.println("计算结果为："+(num1 + num2));
                break;
            case "-":
                System.out.println("计算结果为："+(num1 - num2));
                break;
            case "*":
                System.out.println("计算结果为："+(num1 * num2));
                break;
            case "/":
                System.out.println("计算结果为："+(num1 / num2));
                break;
            case "%":
                System.out.println("计算结果为："+(num1 % num2));
                break;
        }
        scanner.close();
    }
}
